<?php
	 session_start();
	include_once("./commonality.php");
	if(isset($_POST['sub'])){
		$account = trim($_POST['account']);
		$pwd = trim($_POST['pwd']);
		$phone = $_POST['number'];
		$email = $_POST['email'];
		$touxiang = $_POST['touxiang'];
	if($account!="" && $pwd!="" && $phone!="" && $email!=""){
		$pwd=md5($pwd);	
$sel="select * from user where uname='$account'";
	$ren=mysql_query($sel);
	if(mysql_num_rows($ren)>0){
		tankuang("用户名以存在","./register3.php");
		exit;
	}else{
		$time=date("Y-m-d H:i:s",time());
		$ins="insert into user (uname,upassword,utype,uphone,time,touxiang,uemail
		)values('$account','$pwd',0,'$phone','$time','$touxiang','$email')";
		mysql_query($ins);
	if(mysql_affected_rows()>0){
				tankuang("注册成功","./register1.php");
				
			}else{
				tankuang("注册失败","./register3.php");
			
			}
	}	
	}else{
		echo"注册失败";
	}
			
}

?>